<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>post-notemp.php</title>
    <style type="text/css">
        #commlink
        {
            cursor: pointer;
        }
        #commlink:hover
        {
            text-decoration: underline;
        }
    </style>
    <script language="javascript" type="text/javascript">
        function showComment() 
        {
            document.getElementById('commarea').style.display = "block";
        }
    </script>
</head>

<body>
	<fieldset>
        <form id="Post" method="post" action="../post.php">
            <input type="text" />
            <br />
            <a href="../post.php?UserID=".stripslashes($row['UserID'])><input type="submit" value="Đăng" /></a>
        </form>
        <div class="note" id="commlink" onclick="showComment()">Bình luận</div>
        <div id="commarea" style="display:none;">
            <form id="Comment" method="post" action="../comment.php">
                <input type="text" />
                <br />
                <a href="../comment.php?UserID=".stripslashes($row['UserID'])><input type="submit" value="Đăng" /></a>
            </form>    
        </div>
    </fieldset>
	<?php
        //if (isset($_COOKIE["Studial"]))
        //{
			//$nameCookie = $_COOKIE['Studial'];
			
			@ $UserID = $_GET['UserID'];
			
            $ini_array = parse_ini_file("../config1.ini");
			@ $con = mysql_pconnect($ini_array['dblink'], $ini_array['dbuser'], $ini_array['dbpass']);
				
			if (!$con)
			{
				die('Could not connect: ' . mysql_error());
			}
				
			@ mysql_set_charset('utf8');
			@ mysql_select_db($ini_array['dbname']);
			
			$check = "SELECT * FROM `topics` WHERE UserID = '".$UserID."'";
			
			$exist = mysql_query($check) or die('Error, query failed');
				
			$row = mysql_fetch_array($result);
        //}
        //else
        //{
            //header('location: ../login/deletecookies.php');
            //exit;
        //}
	?>
        <table border="1" align="center">
            <tr align="center">
            	<td>UserID</td>
                <td>Content</td>
                <td>dateCreated</td>
                <td>numLiked</td>
                <td>numCommented</td>
            </tr>
            <?php
                for($i=1; $i<=$numresult; $i++)
                {
                    $row = mysql_fetch_array($result);
					echo "<tr><td>".stripslashes($row['UserID'])."</td>";
                    echo "<td>".stripslashes($row['Content'])."</td>";
					echo "<td>".stripslashes($row['dateCreated'])."</td>";
					echo "<td>".stripslashes($row['numLiked'])."</td>";
					echo "<td>".$numCommented = stripslashes($row['numCommented'])."</td></tr>";
                }
            ?>
        </table>
</body>
</html>